package com.songtech.utils;

import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.Date;

public class DateUtil {
	public   static  final   String   HOUR_MINUTE_SECOND="HHmmss";
	/**
	 * 将当前时间格式转换为字符串
	 * @param format
	 * @return
	 */
	public static String format(String format) {
		if (null == format || format.length() == 0) {
			return null;
		}
		Date _date = new Date(System.currentTimeMillis());
		SimpleDateFormat df = new SimpleDateFormat(format);
		return df.format(_date);
	}

	/**
	 * 获取当前时间戳，精确到秒
	 * @return
	 */
	public static Long getCurrentTimeSeconds(){
		return  LocalDateTime.now().toEpochSecond(ZoneOffset.of("+8"));
	}
	
	public static void main(String[] args) {
		System.out.println(getCurrentTimeSeconds());
	}
	

}
